import java.util.Scanner;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/4/27 10:34
 * @description:界面显示
 */
public class DictionaryDisplay {
   static   DictionaryDao dao=new DictionaryDaoHashMap();
  public static void main(String[] args) {
    while (true) {

      welcomeFace();
      Scanner scanner = new Scanner(System.in);
      int num=scanner.nextInt();
      switch (num){
        case 1:
          addFacd();

          break;
        case 2:
          queryFace();
          break;
        case 3:
          System.out.println("欢迎下次使用");
          System.exit(0);
          break;
        default:
          System.out.println("输入有误");
          break;
      }
    }
  }

  private static void queryFace() {
    System.out.println("-----查询词典信息界面----");
    Scanner scanner=new Scanner(System.in);
    System.out.println("请输入英文单词");
    String english=scanner.nextLine();
    String Chinese=dao.query(english);
    if(Chinese==null){
      System.out.println("我的脑子还不够聪明");
    }else {
    System.out.println(english+"翻译成中文是："+Chinese);
  }
  }

  private static void addFacd() {
    System.out.println("-----添加词典信息界面----");
    Scanner scanner=new Scanner(System.in);
    System.out.println("请输入英文单词");
    String english=scanner.nextLine();
    System.out.println("请输入中文");
    String chinese=scanner.nextLine();
    EnglishDictuonary d =new EnglishDictuonary(english,chinese);
    dao.add(d);
    System.out.println("添加成功");
  }

  private static void welcomeFace() {
    System.out.println("-----------欢迎界面---------------");
    System.out.println("1添加词典内容");
    System.out.println("2翻译");
    System.out.println("3退出");
    System.out.println("请输入你的选择");

  }
}
